package com.creative.accountsdk.net.account;

import com.creative.accountsdk.net.Protocol;
import com.creative.accountsdk.net.XParams;
import com.loopj.android.http.RequestParams;

import org.json.JSONObject;

/**
 * 检查第三方账号是否已经存在
 * Created by yinjialiang on 15-6-23.
 */
public class ThirdExistProtocol extends Protocol{
    private int platform;
    private String puid;
    private String ptoken;

    public boolean exist;

    public ThirdExistProtocol(int platform, String puid, String ptoken)
    {
        this.platform = platform;
        this.puid = puid;
        this.ptoken = ptoken;
    }

    @Override
    public RequestParams getParams() {
        return new XParams().put("plat", platform)
                .put("puid", puid)
                .put("ptoken", ptoken)
                .getParams();
    }

    @Override
    public String getUrl() {
        return getUrlPrefix()+"tpacct/exist";
    }

    @Override
    protected void parseReturnMap(JSONObject returnMap) {
        exist = returnMap.optBoolean("exist");
    }
}
